const state = {
  associatedRowList: new Map()
}
const mutations = {
  /* 关联 */
  ASSOCIATED_GOODS: (state, data) => {
    let { row, type } = data
    let name = type || 'skuNo'
    state.associatedRowList.set(row[name], row)
  },
  /* 取消关联 */
  CANCEL_GOODS: (state, data) => {
    let { row, type } = data
    let name = type || 'skuNo'
    state.associatedRowList.delete(row[name])
  },
  /* 清空 */
  CLEAR_GOODS: (state, data) => {
    state.associatedRowList.clear()
  },
  /* 重新赋值 */
  SET_GOODS_AGAIN: (state, data) => {
    state.associatedRowList.clear();
    data.forEach((value, key) => {
      state.associatedRowList.set(key, value)
    })
  }
}
export default {
  namespaced: true,
  state,
  mutations
}
